<%-- 
    Document   : topAcquirenti
    Created on : 11-gen-2013, 11.23.19
    Author     : Luciano
--%>

<%@page import="java.util.List"%>
<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.items.User"%>
<%@page import="it.unitn.science.matr155863_148346_145963.bccastestore.DBManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<%!
    private DBManager db;
        
    @Override
    public void init() throws UnavailableException{
            db=(DBManager)super.getServletContext().getAttribute("db_manager");
            
    }
%>      

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Top Buyer</title>
    </head>
    <body>
        <%
         List<User> topAcquirenti = db.getTopBuyers();
        %>
        <div class="content">
            <h2>Top Buyer:</h2>
            <%
               int i=1;
               for(User buyer:topAcquirenti){                                          
                    %>   
                    <h4><%=i%>° </h4> 
                    <h4>Buyer username: </h4>
                    <a href="<%=response.encodeURL(request.getContextPath()+"/contents/user/userDetails?id="+buyer.getId())%>"
                           ><p><%=buyer.getUsername()%></p> 
                    </a>    
                    <%
                    i++;
                }
            %>                      
        </div>
    </body>
</html>
